<!-- imports -->
<%@page import="www.worq.controller.beans.propietarioBean"%>
<%@page import="www.worq.controller.beans.oficinaBean"%>
<%@page import="java.util.ArrayList"%>
<%@page import="www.worq.controller.beans.personalBean"%>
<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ page language="java"%>
<%
	if (request.getSession().getAttribute("sesion") == null) {
		request.getSession().setAttribute("error", 1);
		response.sendRedirect("loginErrors");
	} else {
		personalBean usuario = (personalBean) request.getSession()
				.getAttribute("sesion");
		ArrayList<propietarioBean> catalogo = (ArrayList) request
				.getAttribute("catPropietarios");
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<!--IMPORTANTO ESTILOS-->
<link rel="stylesheet" href="CSS/intranet.css" type="text/css" />
<link rel="stylesheet" href="CSS/intranetRecepcionista.css"
	type="text/css" />
<!--IMPORTANTO JS-->
<SCRIPT type=text/javascript src="JS/login.js"></SCRIPT>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>OREQ</title>
</head>
<body>
	<!-- Menu -->
	<div id="menu">
		<div id="navcontainer">
			<ul id="navlist">
				<li id="activo"><img title="Login" alt="MENU"
					onmouseover="document.getElementById('menuRoot').style.display ='block'"
					src="IMG/MENU/menu.png" width="70px" height="60px"></li>
			</ul>
		</div>
	</div>
	<div id="menuRoot" class="menuRoot">
		<div id="navcontainer2">
			<%@ include file='menuRecepcionista.jsp'%>
		</div>
	</div>
	<!-- Body -->
	<div id="contenedor"
		onmouseover="document.getElementById('menuRoot').style.display ='none'">
		<!-- header -->
		<div id="header">
			<p class="bienvenida">
				Bienvidenid@<br>
				<%
				out.println(usuario.getOficina());
				out.println("<br>");
				out.println(usuario.getNombre());
				out.println("<br>");
				out.println(usuario.getRol());
				out.println("<br>");
				out.println(usuario.getEmail());
				out.println("<br>");
				out.println(usuario.getDireccion());
				%>
			</p>
		</div>
		<%
			String mensajeError = (String) request.getAttribute("mensaje");
				if (mensajeError != null) {
		%>
		<h4>
			&nbsp;<%=mensajeError%></h4>
		<%
			request.setAttribute("mensaje", null);
				}
		%>
		<hr>
		<input value="+ PROPIETARIO" type="button" class="form-enviar"
			onClick="ocultar_mostrar('ALTAUSER'); return false;">
		<div id="ALTAUSER" style="display: none;" class="body">
			<form action="intranetPropietarios" method="post"
				onSubmit="return validarRegistro(this)" name="altaPersonal">
				<input type='hidden' name='dispatch' value='6' />
				<table id="formularios">
					<tr>
						<td id="coment" colspan="2">+ PROPIETARIO</td>
					</tr>
					<tr>
					<td align="left">RFC: </td>
					<td align="left">NOMBRE: </td>
					</tr>
					<tr>
						<td><input name="rfc" type="text" class="datos" size="44"
							onfocus="if (this.value == 'ESCRIBE RFC') {this.value=''}"
							value="ESCRIBE RFC"
							onblur="if(this.value == '') { this.value='ESCRIBE RFC'}"
							maxlength="18"></td>
						<td><input name="nombre" type="text" class="datos" size="44"
							onfocus="if (this.value == 'ESCRIBE NOMBRE') {this.value=''}"
							value="ESCRIBE NOMBRE"
							onblur="if(this.value == '') { this.value='ESCRIBE NOMBRE'}"
							maxlength="200"></td>
					</tr>
					<tr>
					<td align="left">IDENTIFICACION: </td>
					<td align="left">ID CRENCIAL: </td>
					</tr>
					<tr>
						<td><input name="credencial" type="text" class="datos"
							size="44"
							onfocus="if (this.value == 'TIPO DE CREDENCIAL') {this.value=''}"
							value="TIPO DE CREDENCIAL"
							onblur="if(this.value == '') { this.value='TIPO DE CREDENCIAL'}"
							maxlength="50"></td>
						<td><input name="id_credencial" type="text" class="datos"
							size="44"
							onfocus="if (this.value == 'ESCRIBE ID DE LA CREDENCIAL') {this.value=''}"
							value="ESCRIBE ID DE LA CREDENCIAL"
							onblur="if(this.value == '') { this.value='ESCRIBE ID DE LA CREDENCIAL'}"
							maxlength="13"></td>
					</tr>
					<tr>
					<td align="left" colspan="2">DIRECCION: </td>
					</tr>
					<tr>
						<td colspan="2"><input name="direccion" type="text"
							class="datos" size="95"
							onfocus="if (this.value == 'ESCRIBE DIRECCION') {this.value=''}"
							value="ESCRIBE DIRECCION"
							onblur="if(this.value == '') { this.value='ESCRIBE DIRECCION'}"></td>
					</tr>
					<tr>
						<td colspan="2"><input value="+ AGREGAR" type="submit"
							class="form-enviar"><input value="- CERRAR" type="button"
							class="form-reset"
							onClick="ocultar_mostrar('ALTAUSER'); return false;"></td>
					</tr>
				</table>
			</form>
		</div>
		<hr>

		<%
			for (propietarioBean bean2 : catalogo) {
		%>
		<div id="<%=bean2.getId_propietario()%>" style="display: none;"
			class="body">
			<form action="intranetPropietarios" method="post"
				onSubmit="return validarAltaPersonal(this)" name="altaPersonal">
				<input type='hidden' name='dispatch' value='7' /> <input
					type='hidden' name='id_propietario'
					value='<%=bean2.getId_propietario()%>' />
				<table id="formularios">
					<tr>
						<td id="coment" colspan="2">* ACTUALIZAR</td>
					</tr>
					<tr>
					<td align="left">RFC: </td>
					<td align="left">NOMBRE: </td>
					</tr>
					<tr>
						<td><input name="rfc" type="text" class="datos" size="44"
							value="<%=bean2.getRfc()%>" maxlength="18"></td>
						<td><input name="nombre" type="text" class="datos" size="44"
							value="<%=bean2.getNombre()%>" maxlength="200"></td>
					</tr>
					<tr>
					<td align="left">IDENTIFICACION: </td>
					<td align="left">ID CRENCIAL: </td>
					</tr>
					<tr>
						<td><input name="credencial" type="text" class="datos"
							size="44" value="<%=bean2.getCredencial()%>" maxlength="50"></td>
						<td><input name="id_credencial" type="text" class="datos"
							size="44" value="<%=bean2.getId_credencial()%>" maxlength="13"></td>
					</tr>
					<tr>
					<td align="left" colspan="2">DIRECCION: </td>
					</tr>
					<tr>
						<td colspan="2"><input name="direccion" type="text"
							class="datos" size="95" value="<%=bean2.getDireccion()%>"></td>
					</tr>
					<tr>
						<td colspan="2"><b>CONTRASEÑA DE ADMINISTRACION?</b><input
							name="secreta" type="password" class="datos" size="50"
							value="CONTRASEÑA DE SEGURIDAD?" maxlength="90"
							onfocus="this.value=''"></td>
					</tr>
					<tr>
						<td colspan="2"><input value="* ACTUALIZAR" type="submit"
							class="form-enviar"><input value="- CERRAR" type="button"
							class="form-reset"
							onClick="ocultar_mostrar('<%=bean2.getId_propietario()%>'); return false;"></td>
					</tr>
				</table>
			</form>
		</div>
		<%
			}
		%>
		<table id="customers">
			<tr>
				<th>RFC</th>
				<th>Nombre</th>
				<th>ID</th>
				<th>Editar</th>
			</tr>
			<%
				for (propietarioBean bean : catalogo) {
						out.println("<tr class='alt'>");
						out.println("<td>");
						out.println(bean.getRfc());
						out.println("</td>");
						out.println("<td>");
						out.println(bean.getNombre());
						out.println("</td>");
						out.println("<td>");
						out.println(bean.getId_credencial());
						out.println("</td>");
						out.println("<td align='center'>");
			%>
			<a href="javascript:;"
				onClick="ocultar_mostrar('<%=bean.getId_propietario()%>');">EDITAR</a>
			<%
				out.println("</td>");
						out.println("</tr>");
					}
			%>
		</table>
	</div>
</body>
</html>
<%
	}
%>